﻿#pragma once

#include <QThread>

class ConvertThread : public QThread {
Q_OBJECT

public:
  ConvertThread(QString readFilePath, QString saveFilePath, int sampleRate, bool arr_enableChannel[8])
    : read_file_path{readFilePath},
      save_file_path{saveFilePath},
      sample_rate{sampleRate} {
    memcpy(arr_enableChannel_, arr_enableChannel, sizeof(arr_enableChannel));
  }

  ConvertThread();


protected:
  QString read_file_path;              // 读取文件路径
  QString save_file_path;              // 保存文件路径
  int sample_rate;                      // 采样率
  static constexpr int CHANNELS = 8;    // 通道数
  bool arr_enableChannel_[CHANNELS];    // 启用通道

signals:

  void QuitThread();
};


class CSV2BINThread : public ConvertThread {
Q_OBJECT

public:
  CSV2BINThread(QString readFilePath, QString saveFilePath, int sampleRate, bool arr_enableChannel[8])
    : ConvertThread(readFilePath, saveFilePath, sampleRate, arr_enableChannel) {}


protected:
  void run() override;

};

class BIN2CSVThread : public ConvertThread {
Q_OBJECT

public:
  BIN2CSVThread(QString readFilePath, QString saveFilePath, int sampleRate, bool arr_enableChannel[8])
    : ConvertThread(readFilePath, saveFilePath, sampleRate, arr_enableChannel) {}

protected:
  void run() override;

};
